#pragma once
#include <iostream>

#include "hash.hpp"

namespace ys
{
	template<class K>
	class unordered_set
	{
	public:
		struct SetKeyOfT
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};

		typedef typename hash_bocket<K, K, SetKeyOfT>::const_iterator iterator;
		typedef typename hash_bocket<K, K, SetKeyOfT>::const_iterator const_iterator;

		const_iterator begin() const
		{
			return _hash.cbegin();
		}

		const_iterator end() const
		{
			return _hash.cend();
		}

		const_iterator cbegin() const
		{
			return _hash.cbegin();
		}

		const_iterator cend() const
		{
			return _hash.cend();
		}

		std::pair<const_iterator, bool> insert(const K& data)
		{
			std::pair<typename hash_bocket<K, K, SetKeyOfT>::iterator, bool> ret = _hash.insert(data);
			return std::pair<const_iterator, bool>(ret.first, ret.second);
		}
		HashNode<K>& find(const K& key)
		{
			return _hash.find(key);
		}

		void erase(const K& key)
		{
			_hash.erase(key);
		}
	private:
		hash_bocket<K, K, SetKeyOfT> _hash;
	};
}